<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>
<%@include file="../common/jscss.jsp"%>
<%@include file="../common/selfCss.jsp"%>
<!-- <script src="/nicEdit/nicEdit.js" type="text/javascript"></script>  -->
<script type="text/javascript">
/* bkLib.onDomLoaded(function() { 
    new nicEditor({ fullPanel: true }).panelInstance('guanggao');
}); */
	$(function() {
		$("#add_Content_form").validate({
			success : function(label) {
				label.text("").addClass("validate_success");
			},
			rules : {

				title : {
					required : true,
					minlength : 2,
					maxlength : 16
				}

			},
			messages : {
				title : {
					required : "请输入画的标题",
					minlength : "请填写2个以上字",
					maxlength : "请填写20个以下的字"
				}

			},
			submitHandler : function() {

				$.post("/misc/index/insertAuxContent.htm", {
					title : $("#title").val(),
					link:$("#link").val(),
					channel : $("#channel").val(),
					picture : $("#picture").attr("src"),
					pictureT : $("#pictureT").attr("src"),
					guanggao : $("#guanggao").val(),
					description : $("#description").val()
					
				}, function(data) {
					if (data == "success") {
						//parent.channelList_grid.loadData();
						alert("添加成功！");
						//$.ligerDialog.success("添加成功！");
					}
					if (data == "error") {
						$.ligerDialog.warn("系统有点抽经，请稍候重试！");
					}
				});
			}
		});

		//初始化富文本
		editor = $(".desc")
				.xheditor(
						{
							tools : 'Removeformat,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,Align,Link',
							skin : 'default',
							showBlocktag : false,//段落标签
							internalScript : false,
							internalStyle : false,
							width : 500,
							height : 150,
							fullscreen : false,
							forcePtag : true,
							cleanPaste : 1,
							upMultiple : 1,
							html5Upload : false
						});
		editorguanggao = $("#guanggao").xheditor(
				{
					tools : 'Removeformat,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,Align,Link,Img',
					skin : 'default',
					showBlocktag : false,//段落标签
					internalScript : false,
					internalStyle : false,
					width : 500,
					height : 450,
					fullscreen : false,
					forcePtag : true,
					cleanPaste : 1,
					upMultiple : 1,
					html5Upload : false,
					upImgUrl:"/misc/xheditor/uploadImg.htm",
					upImgExt:"jpg,jpeg,gif,png"
				});

	});
</script>


			
			
					<table width="80%" class="def_t">
						<tr>
							<td>上传图片：</td>
							<td align="left" class="l-table-edit-td">
							<form id="upload_img_form" enctype="multipart/form-data" method="post" action="/misc/artPic/uploadImg.htm">
								<input type="file" onchange="uploadCmsImg(this);return false;""  style="width: 200px;" title="支持jpg、jpeg、gif、png格式，文件小于2M" name="imagecontent" id="imagecontent" />
								<img src="${content.picture}" alt="" class="user_img" id="picture" width="100px;"height="100px"/>　
							</form>
							
							</td>
						</tr>
					</table>
			
			<c:if test="${type eq 'made'}">
					
					<table width="80%" class="def_t">
						<tr>
							<td>(定制)小图上传：</td>
							<td align="left" class="l-table-edit-td">
								<form id="upload_img_formXiao" enctype="multipart/form-data" method="post" action="/misc/artPic/uploadImg.htm">
											<input type="file" onchange="uploadCmsImg(this);return false;""  style="width: 200px;" title="支持jpg、jpeg、gif、png格式，文件小于2M" name="imagecontentT" id="imagecontentT" />
											<img src="${content.pictureT}" alt="" class="user_img" id="pictureT" width="100px;"height="100px"/>　
									</form>
								</td>
						</tr>
					</table>
				
			</c:if>
<form method="post" id="add_Content_form" action="">
	<table width="80%" class="def_t">
		<tr>
			<td>标题：</td>
			<td><input type="text" id="title" name="title" /> <input type="hidden" id="channel" name="channel" value="${channel }" /></td>
		</tr>
		<c:choose>
			<c:when test="${channel eq 'af8b7cd5c2364f4fb67c297fb739a83c'|| channel eq '69413e05d05e4633a5cc98f81a44355b'|| channel eq '0129aaae81364e2388ef0a3b724f9eb7'
			  }"> 
			</c:when>	
			<c:otherwise>
		<tr>
			<td>超链接：</td>
			<td><input type="text" id="link" name="link" /> </td>
		</tr>
		</c:otherwise>
		</c:choose>
		<c:choose>
			<c:when test="${channel eq 'af8b7cd5c2364f4fb67c297fb739a83c'|| channel eq '69413e05d05e4633a5cc98f81a44355b'|| channel eq '0129aaae81364e2388ef0a3b724f9eb7'
			  }"> 
			
			</c:when>	
			<c:otherwise>
				<tr>
					<td>描述：</td>
					<td><textarea id="description" class='desc' name="description"
							cols="200" style="width: 450px"></textarea>
					</td>
				</tr>
		</c:otherwise>
		</c:choose>
		
		<c:choose>
			<c:when test="${channel eq '0129aaae81364e2388ef0a3b724f9eb7'
			   ||  channel eq '69413e05d05e4633a5cc98f81a44355b' || channel eq 'af8b7cd5c2364f4fb67c297fb739a83c'
			  }"> 
			
			</c:when>	
			<c:otherwise>
		<tr>
			<td colspan="2">*以下为广告填写*其他则不需填写</td>
		</tr>
		<tr>
			<td>广告内容：</td>
			<td>
				<textarea id="guanggao" class='guanggao' name="guanggao" cols="200" style="width: 450px"></textarea>
			</td>
		</tr>
		</c:otherwise>
		</c:choose>
		
		<tr>
			<td colspan="2" style="text-align: center;">
				<button type="submit">确定</button></td>
		</tr>
	</table>
</form>
